<template>
  <tr>
      <td><input type="checkbox" v-model="obj.checked"></td>
      <td>{{obj.name}}</td>
      <td>{{obj.price}}</td>
      <td><button @click="obj.num--" :disabled="obj.num <= 1">-</button>{{obj.num}}<button @click="obj.num++">+</button></td>
      <td>{{obj.num * obj.price}}</td>
      <td><button @click="delCart">删除</button></td>
  </tr>
</template>

<script>
export default {
  props: ['obj'],
  methods: {
    // 子传父，自定义方法，触发父自定义方法
    delCart () {
      this.$emit('delCart')
    }
  }
}
</script>

<style>

</style>
